import java.util.Scanner;

public class Main {
    private final String acount;
    private final String password;
    public Main(){
        this.acount = "zhangsan";
        this.password = "123456";
    }
    public static void logIn(String userName, String password) throws AcountWrongException, PasswordWrongException{
        Main main = new Main();
        if(!userName.equals(main.acount)){
            throw new AcountWrongException("账户名错误");
        } else if (!password.equals(main.password)) {
            throw new PasswordWrongException("密码错误");
        }else{
            System.out.println("登录成功");
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        try{
            System.out.println("请输入您的账号：");
            String userName = scanner.nextLine();
            System.out.println("请输入您的密码：");
            String password = scanner.nextLine();
            logIn(userName, password);
        }catch(AcountWrongException e){
            e.printStackTrace();
        }catch(PasswordWrongException e){
            e.printStackTrace();
        }finally{
            scanner.close();
        }
    }
}